package com.piece.mall.api.enums;

import com.piece.core.framework.util.collection.ArrayUtil;
import lombok.Getter;

@Getter
public enum OrderStatusType {

    PREPARE("0","待付款"),

    PAYED("1","已付款"),

    SEND_OUT("2","已发货"),

    COMPLETE("3","已完成"),

    CANCEL("4","已取消"),

    SERVICING("5","售后中"),

    SERVICED("6","售后完成");

    private final String code;
    private final String info;

    OrderStatusType(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public static OrderStatusType getByCode(String code) {
        return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values());
    }
}
